import Vue from 'vue'
import Router from 'vue-router'
import config from './router'

Vue.use(Router)

const pathName = window.location.pathname

const route = new Router({
  mode: 'hash',
  base: (pathName.lastIndexOf('/') > 0) ? pathName.substr(0, pathName.lastIndexOf('/')) : null,
  routes: config
})

route.afterEach(route => {
  console.log('route', route)
})

export default route
